﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.VisualBasic.ApplicationServices;




namespace BGCOP.CAVTOP.WINFORMS
{
    public partial class frmPrincipal : Telerik.WinControls.UI.RadRibbonForm
    {
        private frmInnerRuntime j;
        public bool banderaMartha = true;

        public frmPrincipal()
        {
            InitializeComponent();
            
        }

        private void radButtonElement1_Click(object sender, EventArgs e)
        {
            //tipos de identificacion
            if (BGCOP.CAVTOP.WINFORMS.Program.permisoActual.Substring(0, 1) == "0")
            {
                
                return;
            }
            frmTipoIdentificacion fti = new frmTipoIdentificacion();
            fti.MdiParent = this;
            fti.Show();
        }

        private void btnMcargos_Click(object sender, EventArgs e)
        {
            if (BGCOP.CAVTOP.WINFORMS.Program.permisoActual.Substring(1, 1) == "0")
            {
                
                return;
            }
            frmCargo fca = new frmCargo();
            fca.MdiParent = this;
            
            fca.Show();
        }

        private void frmPrincipal_Load(object sender, EventArgs e)
        {
            if (BGCOP.CAVTOP.WINFORMS.Program.idUsuarioActual != 1)
            {
                frmVisitante objVisitante = new frmVisitante();
                objVisitante.MdiParent = this;
                objVisitante.Show();
            }
            else
            {
                splitContainer1.SplitterDistance = 200;
            }
            tGeneral.Enabled = true;
            tInicio.Enabled = true;
            
        }

        private void btnMestados_Click(object sender, EventArgs e)
        {
            if (BGCOP.CAVTOP.WINFORMS.Program.permisoActual.Substring(2, 1) == "0")
            {
                
                return;
            }
            frmEstadosEmpleado ftmp = new frmEstadosEmpleado();
            ftmp.MdiParent = this;

            ftmp.Show();
        }

        private void btnMempresas_Click(object sender, EventArgs e)
        {
            if (BGCOP.CAVTOP.WINFORMS.Program.permisoActual.Substring(3, 1) == "0")
            {

                return;
            }
            frmEmpresa ftmp = new frmEmpresa();
            ftmp.MdiParent = this;
            ftmp.Show();
        }

        private void btnMdivisiones_Click(object sender, EventArgs e)
        {
            if (BGCOP.CAVTOP.WINFORMS.Program.permisoActual.Substring(4, 1) == "0")
            {

                return;
            }
            frmDivisionesEmpresa ftmp = new frmDivisionesEmpresa();
            ftmp.MdiParent = this;
            ftmp.Show();
        }

        private void btnMempleado_Click(object sender, EventArgs e)
        {
            if (BGCOP.CAVTOP.WINFORMS.Program.permisoActual.Substring(5, 1) == "0")
            {

                return;
            }
            frmEmpleadoOk ftmp = new frmEmpleadoOk();
            ftmp.MdiParent = this;
            ftmp.Show();
        }

        private void btnMvehiculos_Click(object sender, EventArgs e)
        {
            if (BGCOP.CAVTOP.WINFORMS.Program.permisoActual.Substring(6, 1) == "0")
            {

                return;
            }
            frmVehiculo ftmp = new frmVehiculo();
            ftmp.MdiParent = this;
            ftmp.Show();
        }

        private void btnMmarcas_Click(object sender, EventArgs e)
        {
            if (BGCOP.CAVTOP.WINFORMS.Program.permisoActual.Substring(7, 1) == "0")
            {

                return;
            }
            frmMarcaVehiculo ftmp = new frmMarcaVehiculo();
            ftmp.MdiParent = this;
            ftmp.Show();
        }

        private void btnMtiposV_Click(object sender, EventArgs e)
        {
            if (BGCOP.CAVTOP.WINFORMS.Program.permisoActual.Substring(8, 1) == "0")
            {

                return;
            }
            frmTipoVehiculo ftmp = new frmTipoVehiculo();
            ftmp.MdiParent = this;
            ftmp.Show();
        }

        private void btnMmodelo_Click(object sender, EventArgs e)
        {
            if (BGCOP.CAVTOP.WINFORMS.Program.permisoActual.Substring(9, 1) == "0")
            {

                return;
            }
            frmModeloVehiculo2 ftmp = new frmModeloVehiculo2();
            ftmp.MdiParent = this;
            ftmp.Show();
        }

        private void btnMasignaVe_Click(object sender, EventArgs e)
        {
            if (BGCOP.CAVTOP.WINFORMS.Program.permisoActual.Substring(10, 1) == "0")
            {

                return;
            }
            frmVehiculoEmpleado ftmp = new frmVehiculoEmpleado();
            ftmp.MdiParent = this;
            ftmp.Show();
        }

        private void btnMparqueo_Click(object sender, EventArgs e)
        {
            if (BGCOP.CAVTOP.WINFORMS.Program.permisoActual.Substring(11, 1) == "0")
            {

                return;
            }
            frmParqueos ftmp = new frmParqueos();
            ftmp.MdiParent = this;
            ftmp.Show();
        }

        private void btnMasigParqueo_Click(object sender, EventArgs e)
        {
            if (BGCOP.CAVTOP.WINFORMS.Program.permisoActual.Substring(12, 1) == "0")
            {

                return;
            }
            frmAsignaParqueo2 ftmp = new frmAsignaParqueo2();
            ftmp.MdiParent = this;
            ftmp.Show();
        }

        private void btnMhorarios_Click(object sender, EventArgs e)
        {
            if (BGCOP.CAVTOP.WINFORMS.Program.permisoActual.Substring(13, 1) == "0")
            {

                return;
            }
            frmHorario ftmp = new frmHorario();
            ftmp.MdiParent = this;
            ftmp.Show();
        }

        private void btnMtarjetas_Click(object sender, EventArgs e)
        {
            if (BGCOP.CAVTOP.WINFORMS.Program.permisoActual.Substring(14, 1) == "0")
            {

                return;
            }
            frmTarjetas ftmp = new frmTarjetas();
            ftmp.MdiParent = this;
            ftmp.Show();
        }

        private void btnMprogramadas_Click(object sender, EventArgs e)
        {
            if (BGCOP.CAVTOP.WINFORMS.Program.permisoActual.Substring(15, 1) == "0")
            {

                return;
            }
            frmVisitaProgramadaOk_2 ftmp = new frmVisitaProgramadaOk_2();
            ftmp.MdiParent = this;
            ftmp.Show();
        }

        private void radButtonElement2_Click(object sender, EventArgs e)
        {
            if (BGCOP.CAVTOP.WINFORMS.Program.permisoActual.Substring(16, 1) == "0")
            {

                return;
            }
            frmVisitante ftmp = new frmVisitante();
            ftmp.MdiParent = this;
            ftmp.Show();
        }

        private void frmPrincipal_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                Application.Exit();
                j.Close();
                foreach (var obj in this.MdiChildren)
                {
                    obj.Close();
                }
                Application.Exit();
            }
            catch (Exception)
            {
                
                
            }
           

        }

        private void tGeneral_Tick(object sender, EventArgs e)
        {
            label3.Text = DateTime.Now.ToLongTimeString();
            label4.Text = DateTime.Now.ToLongDateString();
        }

        private void tInicio_Tick(object sender, EventArgs e)
        {
            tInicio.Enabled = false;
            lblNombreUsr.Text  = BGCOP.CAVTOP.WINFORMS.Program.UsrActual;
            label2.Text = BGCOP.CAVTOP.WINFORMS.Program.usrAct2;
            fotoUsuario.BackgroundImage = BGCOP.CAVTOP.WINFORMS.Program.Imagen;
            radDock1.AutoDetectMdiChildren = true;
            //splitContainer2.Panel1 
            if (!banderaMartha)
            {
                j = new frmInnerRuntime();
                j.TopLevel = false;

                j.Parent = panel1;
                j.WindowState = FormWindowState.Maximized;
                j.Show();
            }
            
            
        }

        private void radButtonElement3_Click(object sender, EventArgs e)
        {
            if (BGCOP.CAVTOP.WINFORMS.Program.permisoActual.Substring(17, 1) == "0")
            {

                return;
            }
            frmUsuario frmtp = new frmUsuario();
            frmtp.MdiParent = this;
            frmtp.Show();
        }

        private void radButtonElement4_Click(object sender, EventArgs e)
        {
            if (BGCOP.CAVTOP.WINFORMS.Program.permisoActual.Substring(18, 1) == "0")
            {

                return;
            }
            frmTipoUsuario frmtp = new frmTipoUsuario();
            frmtp.MdiParent = this;
            frmtp.Show();
        }

        private void frmPrincipal_Resize(object sender, EventArgs e)
        {
            
        }

        private void radButtonElement5_Click(object sender, EventArgs e)
        {
            if (BGCOP.CAVTOP.WINFORMS.Program.permisoActual.Substring(19, 1) == "0")
            {

                return;
            }
            frmLiberaParqueo frmtp = new frmLiberaParqueo();
            frmtp.MdiParent = this;
            frmtp.Show();
        }

        private void radButtonElement6_Click(object sender, EventArgs e)
        {
            frmListadoEmpleados frmtp = new frmListadoEmpleados();
            frmtp.MdiParent = this;
            frmtp.Show();
        }

        private void radButtonElement7_Click(object sender, EventArgs e)
        {
            frmListadoVehiculosParqueo frmtp = new frmListadoVehiculosParqueo();
            frmtp.MdiParent = this;
            frmtp.Show();
        }

        private void radButtonElement8_Click(object sender, EventArgs e)
        {
            frmReporteMarcacionesEmpleado frmtp = new frmReporteMarcacionesEmpleado();
            frmtp.MdiParent = this;
            frmtp.Show();
        }

        private void radButtonElement9_Click(object sender, EventArgs e)
        {
            frmReporteMarcacionesVisitantes frmtp = new frmReporteMarcacionesVisitantes();
            frmtp.MdiParent = this;
            frmtp.Show();
        }

       
    }
}
